package com.cmwa.scbp.utils.cached.schedule;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.cmwa.scbp.base.exception.CachedException;
import com.cmwa.scbp.utils.cached.service.ShareCachedService;


@Service
public class RefreshShareCachedSchedule {
	private static Logger log = LoggerFactory.getLogger(RefreshShareCachedSchedule.class);
	
	@Resource(name="shareCachedService")
	private ShareCachedService shareCachedService;
	/**
	 *  * 执行公共缓存的初始化，初始化加载所有的数据到缓存
	 */
	public void execute(){
		try {
			long start =System.currentTimeMillis();
			shareCachedService.loadMappingCached();
			long end =System.currentTimeMillis();
			log.info("RefreshShareCachedSchedule RUN Speed Time:"+(end-start) +" ms");
		} catch (CachedException e) {
			log.error("RefreshShareCachedSchedule.initLoadAllCached ERROR");
		}
	}

}
